package com.atguigu.jxc.controller;/*
 *@author 尹凯瑞
 *@date 2020/12/2 19:45
 */

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("supplier")
public class SupplierController {

    @Autowired
    private SupplierService supplierService;

    //分页查询供应商 //http://localhost:8080/supplier/list
    @RequestMapping("/list")
    public Map<String,Object> listSupplier(Integer page, Integer rows, String supplierName){
        return  supplierService.listSupplier(page,rows,supplierName);
    }
    //添加或修改供应商 http://localhost:8080/supplier/save?supplierId=1
    @RequestMapping("/save")
    public ServiceVO saveOrUpdate(Supplier supplier){

        return supplierService.saveOrUpdate(supplier);

    }
    //删除供应商 http://localhost:8080/supplier/delete
    @RequestMapping("/delete")
    public ServiceVO delete(String ids){
        return  supplierService.deleteSupplier(ids);
    }

}
